#include <stdio.h>
#include <string.h>

int shu[102][102];
int n;
int rol[102];
int max;
int temp;

int main()
{
	int i, j, k;

	scanf("%d", &n);
	for (i=1; i<=n; ++i)
		for (j=1; j<=n; ++j)
			scanf("%d", &shu[i][j]);

	max=shu[1][1];
	for (i=1; i<=n; ++i)
	{
		memset(rol, 0, sizeof(rol));
		for (j=i; j<=n; ++j)
		{
			for (k=1; k<=n; ++k)
				rol[k] += shu[j][k];
			temp=0;
			for (k=1; k<=n; ++k)
			{
				temp += rol[k];
				if (temp>max) max = temp;
				if (temp<0) temp = 0;				
			}
		}
	}
	printf("%d\n", max);


	return 0;
}